package eg.com.itiga.ui.actions.graphs;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jfree.chart.servlet.ServletUtilities;

public class DisplayGraph extends org.apache.struts.action.Action {
    
    
    public DisplayGraph() {
    }
    
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        // TODO: Write method body
    	System.out.println("----------------------====================--------------------");
    	response.reset(); 
		HttpSession session = request.getSession(); 
		System.out.println("----------------------====================--------------------");
		String fname = (String) session.getAttribute("filename");
		System.out.println("----------------------====================--------------------");
		 System.out.println(fname);
		response.setContentType("image/png"); 

		ServletUtilities.sendTempFile(fname,response); 


		return null; 

    }

}